<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
          "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:facelets="http://java.sun.com/jsf/facelets"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:p="http://primefaces.prime.com.tr/ui"
	xmlns:ui="http://java.sun.com/jsf/facelets">
<h:head>

	<script type="text/javascript">
		PrimeFaces.widget.Uploader.prototype._createPostParams = function() {
			var b = {};
			b[PrimeFaces.PARTIAL_REQUEST_PARAM] = true;
			b[PrimeFaces.PARTIAL_PROCESS_PARAM] = this.id;
			b[PrimeFaces.PARTIAL_SOURCE_PARAM] = this.id;
			b[PrimeFaces.VIEW_STATE] = PrimeFaces.ajax.AjaxUtils
					.encodeViewState();
			if (this.cfg.update) {
				b[PrimeFaces.PARTIAL_UPDATE_PARAM] = this.cfg.update
			}
			var a = PrimeFaces.getCookie("JSESSIONID");
			if (this.cfg.script.indexOf("jsessionid") == -1) {
				paramIndex = this.cfg.script.indexOf('?');
				if (paramIndex != -1) {
					this.cfg.script = this.cfg.script.substring(0, paramIndex)
							+ ";jsessionid=" + a
							+ this.cfg.script.substring(paramIndex);
				} else {
					this.cfg.script = this.cfg.script + ";jsessionid=" + a;
				}
			}
			b['cid'] = "#{javax.enterprise.context.conversation.id}";
			return b;
		};
		PrimeFaces.widget.Uploader.prototype.createPostParams = PrimeFaces.widget.Uploader.prototype._createPostParams;

		var _gaq = _gaq || [];
		_gaq.push([ '_setAccount', 'UA-25161614-1' ]);
		_gaq.push([ '_trackPageview' ]);

		(function() {
			var ga = document.createElement('script');
			ga.type = 'text/javascript';
			ga.async = true;
			ga.src = ('https:' == document.location.protocol ? 'https://ssl'
					: 'http://www')
					+ '.google-analytics.com/ga.js';
			var s = document.getElementsByTagName('script')[0];
			s.parentNode.insertBefore(ga, s);
		})();
	</script>
	<link rel="stylesheet" href="/Poseidon/css/myStyle.css" type="text/css" media="all" />
	
</h:head>
<h:body>
	<h:form>

		<p:layoutUnit position="north" size="400" resizable="true"
			closable="true" collapsible="true">

			<p:layout style="min-width:400px;min-height:200px;" id="layout">

				<p:layoutUnit position="west" resizable="true" size="210"
					minSize="40" maxSize="210">
					<ui:include src="/pages/menu.xhtml" />

				</p:layoutUnit>

				<p:layoutUnit position="center">

					<h:panelGrid columns="1" cellpadding="3"
						style="width:40%;margin-left:25%;">
						<h:graphicImage url="/images/headers/agregar_empleado.png" />
						<p:panel id="panel">
							<h:panelGrid columns="4" cellpadding="5">
								<h:outputLabel for="firstname" value="Nombre: *" />
								<p:inputText id="firstname"
									requiredMessage="Este campo es obligatorio"
									value="#{tableBean.selectedEmployee.firstname}" required="true"
									label="Firstname">
								</p:inputText>
								<p:watermark for="firstname" value="Ingrese un nombre" />
								<p:message for="firstname" />

								<h:outputLabel for="lastname" value="Apellido: *" />
								<p:inputText id="lastname"
									requiredMessage="Este campo es obligatorio"
									value="#{tableBean.selectedEmployee.lastname}" required="true"
									label="Lastname" />
								<p:watermark for="lastname" value="Ingrese un apellido" />
								<p:message for="lastname" />

								<h:outputLabel for="area" value="Area: *" />
								<p:inputText id="area"
									value="#{tableBean.selectedEmployee.area}"
									requiredMessage="Este campo es obligatorio" required="true"
									label="Area">
									<f:validateLength minimum="2" />
								</p:inputText>
								<p:watermark for="area" value="Ingrese un area" />
								<p:message for="area" />

								<h:outputLabel for="startDate" value="Fecha de Ingreso: *" />
								<p:calendar id="startDate" binding="#{startDate}"
									value="#{tableBean.selectedEmployee.startDate}" pattern="dd/MM/yyyy" />
								<p:watermark for="startDate" value="Fecha de Ingreso" />
								<p:message for="startDate" />

								<h:outputLabel for="username" value="Username: *" />
								<p:inputText id="username"
									requiredMessage="Este campo es obligatorio"
									value="#{tableBean.selectedEmployee.username}" required="true"
									label="Username">
								</p:inputText>
								<p:watermark for="username" value="Ingrese un usuario" />

								<p:message for="username" />

								<h:outputLabel for="password" value="Password: *" />
								<p:inputText id="password"
									requiredMessage="Este campo es obligatorio"
									value="#{tableBean.selectedEmployee.password}" required="true"
									label="Password: *">
								</p:inputText>
								<p:watermark for="password" value="Ingrese un password" />
								<p:message for="password" />

								<h:outputLabel for="group" value="Grupo: *" />
								<h:selectOneMenu value="#{tableBean.selectedGroup}"
									converter="groupConverter">
									<f:selectItems id="group" value="#{tableBean.groups}"
										var="group" itemLabel="#{group.name}" itemValue="#{group.id}" />
								</h:selectOneMenu>
								<p:message for="group" />


							</h:panelGrid>

							<p:commandButton value="Guardar" ajax="false"
								actionListener="#{tableBean.save}"
								action="dashboard?faces-redirect=true" />
							<p:commandButton value="Volver" ajax="false"
								action="dashboard?faces-redirect=true" immediate="true" />
						</p:panel>

					</h:panelGrid>


				</p:layoutUnit>
			</p:layout>
		</p:layoutUnit>
	</h:form>

</h:body>
</html>